package io.renren.modules.health.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.health.dao.HmSportRecordDao;
import io.renren.modules.health.dto.HmSportRecordDTO;
import io.renren.modules.health.entity.HmSportRecordEntity;
import io.renren.modules.health.service.HmSportRecordService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.Map;

/**
 * 客户运动记录
 *
 * @author  
 * @since 1.0.0 2024-04-03
 */
@Service
public class HmSportRecordServiceImpl extends CrudServiceImpl<HmSportRecordDao, HmSportRecordEntity, HmSportRecordDTO> implements HmSportRecordService {

    @Override
    public QueryWrapper<HmSportRecordEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        Long cusId = (Long)params.get("cusId");
        LocalDate recordDate = (LocalDate)params.get("recordDate");

        QueryWrapper<HmSportRecordEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.eq(cusId != null, "cus_id", cusId);
        wrapper.eq(recordDate != null, "record_date", recordDate);

        return wrapper;
    }


}